home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / tsipp / tsipp.lha / tsipp3.0a / demos / chain.tcl next >
Encoding:
Text File  |  1992-11-02  |  1.9 KB  |  64 lines

  1. #==============================================================================
  2. #                                chain.tcl
  3. #------------------------------------------------------------------------------
  4. # A port of SIPP demo program chain.c to Tcl-SIPP.
  5. #------------------------------------------------------------------------------
  6. # $Id: chain.tcl,v 2.0 1992/11/02 03:55:21 markd Rel $
  7. #------------------------------------------------------------------------------
  8.  
  9. source util.tcl
  10. ParseArgs
  11.  
  12. set M_PI     3.14159265358979323846
  13.  
  14. set SMALLRES 15
  15. set BIGRES   39
  16.  
  17. SippLightSourceCreate {1.0   1.0 1.0} {0.9 0.9 0.9} DIRECTION
  18. SippLightSourceCreate {-1.0 -1.0 0.5} {0.4 0.4 0.4} DIRECTION
  19.  
  20.  
  21. set shader [SippShaderBasic 0.5 0.6 0.2 {0.8 0.6 0.3}]
  22. set torus  [SippTorus 1.0 0.23 $BIGRES $SMALLRES  $shader WORLD]
  23.  
  24. set torus_pair [SippObjectCreate]
  25. SippObjectAddSubobj $torus_pair $torus
  26.  
  27. set torus2  [SippObjectInstance $torus]
  28. SippObjectMove $torus2 {0.0 -1.375 0.0}
  29. SippObjectRotateY $torus2 [expr $M_PI/2.0]
  30. SippObjectAddSubobj $torus_pair $torus2
  31.  
  32. set chain [SippObjectCreate]
  33. SippObjectMove $torus_pair {-1.375 1.375 0.0}
  34. SippObjectAddSubobj $chain $torus_pair
  35.  
  36. set torus_pair2 [SippObjectInstance $torus_pair]
  37. SippObjectRotateZ $torus_pair2 [expr $M_PI/2.0]
  38. SippObjectMove $torus_pair2 {-1.375 -1.375 0.0}
  39. SippObjectAddSubobj $chain $torus_pair2
  40.  
  41. set torus_pair3 [SippObjectInstance $torus_pair2]
  42.  
  43. SippObjectRotateZ $torus_pair3 $M_PI
  44. SippObjectMove $torus_pair3 {1.375 -1.375 0.0}
  45. SippObjectAddSubobj $chain $torus_pair3
  46.  
  47. set torus_pair4 [SippObjectInstance $torus_pair3]
  48. SippObjectRotateZ $torus_pair4 [expr 3.0*$M_PI/2.0]
  49. SippObjectMove $torus_pair4  {1.375 1.375 0.0}
  50. SippObjectAddSubobj $chain $torus_pair4
  51.  
  52. SippObjectAddSubobj WORLD $chain
  53.  
  54. set camera [SippCameraCreate {5.0 -2.0 15.0} {0.5 0.0 0.0} {0.0 0.0 1.0} 0.25]
  55. SippCameraUse $camera
  56.  
  57. if {$G_mode == "LINE"} {
  58.     SippBackground {0 .4 0}
  59.     SippLineColor {1 0 0} 
  60. }
  61.  
  62. DoRendering "chain"
  63.  
  64.